package 面试;
/**
 * 华为 2020 社会招聘笔试题
 */

import java.util.Scanner;

public class ASCII码最小的最长连续字符串 {

    public static String maxMinAcsiiStr(String str) {
        if (str == null || str.length() == 0) {
            return "";
        }
        int start = 0;
        int end = 1;
        int maxStart = 0;
        int maxEnd = 1;
        int len = 0;
        char[] chars = str.toCharArray();
        for (int i = 1; i <= chars.length; i++) {
            if (i != chars.length && chars[i-1] != chars[i]
                    || i == chars.length) {
                end = i;
                len = end - start;
                if (len > (maxEnd - maxStart) ||
                        len == (maxEnd - maxStart) && chars[start] < chars[maxStart]) {
                    maxStart = start;
                    maxEnd = end;
                }
                start = end;
            }
        }
        return str.substring(maxStart, maxEnd);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.next();
        System.out.println(maxMinAcsiiStr(str));
    }
}
